Soru & Cevap

Android unfortunately has stopped hatası

18.09.2014 - 04:49

Konum bilğimi alırken sürekli uygulama daha açılmadan bu hatayı alıyorum. LocationManeger kullanarak konum bilgimi alabildigimi fakat ConnectionCallbacks ve OnConnectionFailedListener'i implement ederek denedigimde bu hatayı aldığımı farkettim.

<LogCat>

09-18 09:45:38.701: E/AndroidRuntime(812): FATAL EXCEPTION: main
09-18 09:45:38.701: E/AndroidRuntime(812): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.frknbrgl.nerdeyim/com.frknbrgl.nerdeyim.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /system/lib]]
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.os.Looper.loop(Looper.java:137)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.main(ActivityThread.java:5103)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.reflect.Method.invokeNative(Native Method)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.reflect.Method.invoke(Method.java:525)
09-18 09:45:38.701: E/AndroidRuntime(812):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-18 09:45:38.701: E/AndroidRuntime(812):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-18 09:45:38.701: E/AndroidRuntime(812):     at dalvik.system.NativeStart.main(Native Method)
09-18 09:45:38.701: E/AndroidRuntime(812): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.frknbrgl.nerdeyim.MainActivity" on path: DexPathList[[zip file "/data/app/com.frknbrgl.nerdeyim-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.frknbrgl.nerdeyim-1, /system/lib]]
09-18 09:45:38.701: E/AndroidRuntime(812):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-18 09:45:38.701: E/AndroidRuntime(812):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
09-18 09:45:38.701: E/AndroidRuntime(812):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
09-18 09:45:38.701: E/AndroidRuntime(812):     ... 11 more

<MainActivty>

import android.location.Location;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;

public class MainActivity extends FragmentActivity implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener {
    
    private LocationClient locationClient;
    private LocationRequest locationRequest;
    private TextView enlemTextView;
    private TextView boylamTextView;
   

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        enlemTextView = (TextView) findViewById(R.id.textView1);
        boylamTextView = (TextView) findViewById(R.id.textView2);
               
        locationClient = new LocationClient(this, this, this);
        
        locationRequest = LocationRequest.create()
                  .setInterval(5000)
                  .setFastestInterval(16)
                  .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    }
    
    @Override
    public void onLocationChanged(Location location) {
        enlemTextView.setText(String.valueOf(location.getLatitude()));
        boylamTextView.setText(String.valueOf(location.getLongitude()));
        
            }
    

    @Override
    public void onConnected(Bundle connectionHint) {
        locationClient.requestLocationUpdates(locationRequest, this);
    }

    @Override
    public void onDisconnected() {}

    @Override
    public void onConnectionFailed(ConnectionResult result) {}

    @Override
    protected void onResume() {
        super.onResume();
        locationClient.connect();
    }

    @Override
    public void onPause() {
        super.onPause();
        
        if(locationClient.isConnected())
            locationClient.removeLocationUpdates(this);
        
        locationClient.disconnect();
    }

}

 

<AndroidManifest>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.frknbrgl.nerdeyim"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="18"
        android:targetSdkVersion="18" />
    
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

41 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-2335-1379625106.jpg
rocxteady
18.09.2014 - 02:17


Clean yapıp tekrar denedin mi?